//
// Created by ls on 24-1-1.
//
#include <iostream>
#include <map>
using namespace std;


// map 容器 排序
namespace Test
{
    class MycompareMap {
    public:
        bool operator()(const int v1,const int v2) const
        {
            return v1 > v2;
        }
    };

    void printMap(const map<int, int, MycompareMap> &M)
    {
        for (auto &[key, value] : M) {
            cout << "key = " << key << ", value = " << value << endl;
        }
    }

    void test01()
    {
        map<int, int, MycompareMap> m;
        m.insert(make_pair(1, 10));
        m.insert(make_pair(2, 20));
        m.insert(make_pair(3, 30));
        m.insert(make_pair(4, 40));
        m.insert(make_pair(5, 50));
        printMap(m);
    }
}

int main()
{
    Test::test01();
}